/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * RSPerspective.h
 *
 *  Created on: 2010/03/08
 *      Author: Alexandre Pires ( c.alexandre.pires@gmail.com )
 */

#ifndef RSPERSPECTIVE_H_
#define RSPERSPECTIVE_H_

#include "RSProjectionTechniqueElement.h"

namespace Realsphere {

    class RSPerspective : public Realsphere::RSProjectionTechniqueElement {
        Q_OBJECT
        public:
            RSPerspective ( const QString& rScopeId = QString::null );
            virtual ~RSPerspective ();

        public:
            RSFloat*                    HorizontalFieldOfView () const;
            RSFloat*                    VerticalFieldOfView () const;
            QMatrix4x4                  ProjectionMatrix () const;

        public slots:
            RSError                     SetHorizontalFieldOfView ( RSFloat* rValue );
            RSError                     SetVerticalFieldOfView ( RSFloat* rValue );

            RSError                     SetHorizontalFieldOfView ( const RSFloat& rValue );
            RSError                     SetVerticalFieldOfView ( const RSFloat& rValue );

            RSError                     SetHorizontalFieldOfView ( const float& rValue );
            RSError                     SetVerticalFieldOfView ( const float& rValue );

        protected:
            RSError                     BeforeAddValueElementValidation ( RSValueElement* rValueElement );
            RSError                     BeforeRemoveValueElementValidation ( RSValueElement* rValueElement );
            bool                        AfterAddValueElementValidation ( RSValueElement* rValueElement );
            bool                        AfterRemoveValueElementValidation ( RSValueElement* rValueElement );
            void                        UpdateProjection ();

        signals:
            void                        HorizontalFieldOfViewChanged ( RSPerspective* rPerspective, RSFloat* rValue );
            void                        VerticalFieldOfViewChanged ( RSPerspective* rPerspective, RSFloat* rValue );

        private:
            RSFloat*                    mHorizontalFieldOfView;
            RSFloat*                    mVerticalFieldOfView;
    };
}

#endif /* RSPERSPECTIVE_H_ */
